package com.xl.rentkeeper.util;

import com.xl.fuse.protos.account.Ret;
import com.xl.fuse.protos.packet.RetCode;
import com.xl.rentkeeper.R;

import java.util.HashMap;

/**
 * Created by Administrator on 2015/7/23.
 */
public class ErrString {
    public static HashMap<Integer,Integer> errMap = null;
    static{
        errMap = new HashMap<Integer,Integer>();
        errMap.put(Ret.REGISTERED.getValue(), R.string.registered);
        errMap.put(Ret.PHONE_FORMAT_ERR.getValue(), R.string.phoneformaterr);
        errMap.put(Ret.VERCODE_SEND_ERR.getValue(), R.string.vercodesenderr);
        errMap.put(Ret.VERCODE_ERR.getValue(), R.string.vercodeerr);
        errMap.put(Ret.VERCODE_EXPIRED.getValue(), R.string.vercodeexpired);
        errMap.put(Ret.PASSWORD_FORMAT_ERR.getValue(), R.string.pwdformaterr);
        errMap.put(Ret.USERINFO_FORMAT_ERR.getValue(), R.string.userinfoformaterr);
        errMap.put(RetCode.TIMEOUT.getValue(), R.string.timeout);
        errMap.put(RetCode.PROTO_ERROR.getValue(), R.string.pb_err);
        errMap.put(RetCode.EXCEPTION.getValue(), R.string.ser_err);
    }
    public static int getErrTip(int retCode){
        if(errMap==null || errMap.get(retCode)==null){
            return R.string.unknowerr;
        }
        return errMap.get(retCode);
    }
}
